<?php
/**
 * 菜单数据类
 * User: linweixin(502510773@qq.com)
 * Date: 2018/2/10
 * Time: 10:35
 */
namespace app\admin\model;
use think\Model;
class Menu extends Model{
    /**
     * @param string $menu_type
     * @param int $pid
     * @param int $role_id
     * @return false|\PDOStatement|string|\think\Collection
     */
    public function _list($menu_type='left_menu',$pid = 0,$role_id=0){
        //TODO 暂留角色id 获取对应的菜单
        return self::where(['menu_type'=>$menu_type,'menu_pid'=>$pid])->order('sort DESC')->select();
    }

    public function _getPid($controller=''){
        return self::where(['controller'=>$controller,'menu_pid' => 0])->value('menu_id');
    }

}